Optimal. Leaf size=41 \[ -b \sin (2 a) \text{CosIntegral}\left (\frac{2 b}{x}\right )-b \cos (2 a) \text{Si}\left (\frac{2 b}{x}\right )+x \sin ^2\left (a+\frac{b}{x}\right ) \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0905833, antiderivative size = 41, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 6, integrand size = 10, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.6, Rules used = {3361, 3313, 12, 3303, 3299, 3302} \[ -b \sin (2 a) \text{CosIntegral}\left (\frac{2 b}{x}\right )-b \cos (2 a) \text{Si}\left (\frac{2 b}{x}\right )+x \sin ^2\left (a+\frac{b}{x}\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3361
Rule 3313
Rule 12
Rule 3303
Rule 3299
Rule 3302
Rubi steps
\begin{align*} \int \sin ^2\left (a+\frac{b}{x}\right ) \, dx &=-\operatorname{Subst}\left (\int \frac{\sin ^2(a+b x)}{x^2} \, dx,x,\frac{1}{x}\right )\\ &=x \sin ^2\left (a+\frac{b}{x}\right )-(2 b) \operatorname{Subst}\left (\int \frac{\sin (2 a+2 b x)}{2 x} \, dx,x,\frac{1}{x}\right )\\ &=x \sin ^2\left (a+\frac{b}{x}\right )-b \operatorname{Subst}\left (\int \frac{\sin (2 a+2 b x)}{x} \, dx,x,\frac{1}{x}\right )\\ &=x \sin ^2\left (a+\frac{b}{x}\right )-(b \cos (2 a)) \operatorname{Subst}\left (\int \frac{\sin (2 b x)}{x} \, dx,x,\frac{1}{x}\right )-(b \sin (2 a)) \operatorname{Subst}\left (\int \frac{\cos (2 b x)}{x} \, dx,x,\frac{1}{x}\right )\\ &=-b \text{Ci}\left (\frac{2 b}{x}\right ) \sin (2 a)+x \sin ^2\left (a+\frac{b}{x}\right )-b \cos (2 a) \text{Si}\left (\frac{2 b}{x}\right )\\ \end{align*}
Mathematica [A] time = 0.0913828, size = 41, normalized size = 1. \[ -b \sin (2 a) \text{CosIntegral}\left (\frac{2 b}{x}\right )-b \cos (2 a) \text{Si}\left (\frac{2 b}{x}\right )+x \sin ^2\left (a+\frac{b}{x}\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.014, size = 52, normalized size = 1.3 \begin{align*} -b \left ( -{\frac{x}{2\,b}}+{\frac{x}{2\,b}\cos \left ( 2\,a+2\,{\frac{b}{x}} \right ) }+{\it Si} \left ( 2\,{\frac{b}{x}} \right ) \cos \left ( 2\,a \right ) +{\it Ci} \left ( 2\,{\frac{b}{x}} \right ) \sin \left ( 2\,a \right ) \right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [C] time = 1.13638, size = 89, normalized size = 2.17 \begin{align*} -\frac{1}{2} \,{\left ({\left (-i \,{\rm Ei}\left (\frac{2 i \, b}{x}\right ) + i \,{\rm Ei}\left (-\frac{2 i \, b}{x}\right )\right )} \cos \left (2 \, a\right ) +{\left ({\rm Ei}\left (\frac{2 i \, b}{x}\right ) +{\rm Ei}\left (-\frac{2 i \, b}{x}\right )\right )} \sin \left (2 \, a\right )\right )} b - \frac{1}{2} \, x \cos \left (\frac{2 \,{\left (a x + b\right )}}{x}\right ) + \frac{1}{2} \, x \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.45208, size = 167, normalized size = 4.07 \begin{align*} -x \cos \left (\frac{a x + b}{x}\right )^{2} - b \cos \left (2 \, a\right ) \operatorname{Si}\left (\frac{2 \, b}{x}\right ) - \frac{1}{2} \,{\left (b \operatorname{Ci}\left (\frac{2 \, b}{x}\right ) + b \operatorname{Ci}\left (-\frac{2 \, b}{x}\right )\right )} \sin \left (2 \, a\right ) + x \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \sin ^{2}{\left (a + \frac{b}{x} \right )}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \sin \left (a + \frac{b}{x}\right )^{2}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]